<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@taglib uri="/WEB-INF/tld/components.tld" prefix="up"%>
<%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<%@taglib tagdir="/WEB-INF/tags" prefix="p"%>
<%@ taglib prefix="pp" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:useBean id="agora" class="java.util.Date" />
<%@page import="com.sun.org.apache.bcel.internal.generic.Select"%><html
	xmlns="http://www.w3.org/1999/xhtml">
<jsp:include page="header.jsp">
	<jsp:param name="function" value="Cadastro de Sonhos" />
</jsp:include>
<jsp:include page="/Autorizacao.jsp" flush="false" />
<jsp:useBean id="cadSonhoBean" scope="request"
	class="edu.up.beans.SonhoBean" />


<body>
<!-- begin #container -->
<div id="container"><!-- begin #header -->
<div id="header">
<div class="headerBackground"></div>
<div id="navcontainer">
<ul id="navlist">
	<li><a href="index.jsp"><up:label property="menu.home" /></a></li>
	<li><a href="Sonhos.jsp"><up:label property="menu.sonhos" /></a></li>
	<li><a
		href="<%=request.getContextPath()%>/RelatoriosServlet?acao=RelDepoimentos"><up:label
		property="menu.depoimentos" /></a></li>
	<li id="active"><a href="Login.jsp" id="current"><up:label
		property="menu.login" /></a></li>
	<li><a href="Sobre.jsp"><up:label property="menu.sobre" /></a></li>
	<li><up:countryOption country="Brasil" locale="pt_BR" /></li>
	<li><up:countryOption country="USA" locale="en_US" /></li>
	<li><up:countryOption country="Espanha" locale="es_ES" /></li>
	<li><a
		href="<%=request.getContextPath()%>/ControleServlet?funcao=Start"><img
		src="images/logout.png" alt="Logout" /></a></li>
</ul>
</div>
</div>
<!-- end #header --> <!-- begin #mainContent -->
<div id="mainContent" align="center">
<div class="t">
<div class="b">
<div class="l">
<div class="r">
<div class="bl">
<div class="br">
<div class="tl">
<div class="tr">
<form id="frmCadSonho" name="frmCadSonho" method="post" action="">
<up:label property="sonho.titulo" />
<table border="0">
	<tr align="left">
		<td><up:label property="sonho.lugar" /></td>
		<td><input type="text" name='lugar' size='20' maxlength="20"
			value='<jsp:getProperty property="lugar" name="cadSonhoBean"/>' /></td>
	</tr>
	<tr align="left">
		<td><up:label property="sonho.data" /></td>
		<td><p:dataSonho /></td>
	</tr>
	<tr align="left">
		<script>
		function SomenteNumero(e){
			    var tecla=(window.event)?event.keyCode:e.which;   
			    if((tecla>47 && tecla<58)) return true;
			    else{
			    	if (tecla==8 || tecla==0) return true;
				else  return false;
			    }
			}
	</script>
		<td><up:label property="sonho.valor" /></td>
		<td><input type="text" name='valor' size='20' maxlength="20"
			value='<jsp:getProperty property="valor" name="cadSonhoBean"/>'
			onkeypress="return SomenteNumero(event)" /></td>
	</tr>
	<tr align="left">
		<td><up:label property="sonho.texto" /></td>
		<!-- td><input type="text" name='txtDesc' size='60' maxlength="120" style="height: 50px"
			value='<jsp:getProperty property="descricao" name="cadSonhoBean"/>' /></td>-->
		<td><textarea name="txtDesc" id="txtDesc" cols="48" rows="10"><jsp:getProperty
			property="descricao" name="cadSonhoBean" /></textarea></td>

	</tr>
	<tr align="left">
		<td><up:label property="sonho.forn" /></td>
		<td><up:mySelect name="selectFornecedores" /></td>
	</tr>
	<tr align="left">
		<%
			String tipo = cadSonhoBean.getTipo();
			if (tipo == null) {
				tipo = "";
			}
		%>
		<td><up:label property="sonho.tipo" /></td>
		<td><select id="tipo" name="tipo">
			<option value="none" <%if (tipo.equals("none")) {%> SELECTED <%}%>><up:label
				property="motivo.selecione" /></option>
			<option value="Aventura" <%if (tipo.equals("Aventura")) {%> SELECTED
				<%}%>><up:label property="sonho.aventura" /></option>
			<option value="Jantar" <%if (tipo.equals("Jantar")) {%> SELECTED
				<%}%>><up:label property="sonho.jantar" /></option>
			<option value="Viagem" <%if (tipo.equals("Viagem")) {%> SELECTED
				<%}%>><up:label property="sonho.viagem" /></option>
			<option value="Automobilismo" <%if (tipo.equals("Automobilismo")) {%>
				SELECTED <%}%>><up:label property="sonho.auto" /></option>
			<option value="Outro" <%if (tipo.equals("Outro")) {%> SELECTED <%}%>><up:label
				property="sonho.outro" /></option>
		</select></td>
	</tr>
	<tr align="left">
		<%
			String resultado = (String) request.getAttribute("resultado");
			if (resultado == null) {
				resultado = "";
			}
		%>
		<td align="right">
		<%
			if (resultado.equals("1")) {
		%> <input type="button" name='btnAlterar'
			value="<up:label property="botao.alterar" />"
			onclick="javascript:validar('Alterar')">
		<%
			} else {
		%> <input type="button" name='btnGravar'
			value="<up:label property="botao.gravar" />"
			onclick="javascript:validar('Gravar')">
		<%
			}
			;
		%>
		</td>

		<td align="right"><input type="reset" name="btnReset"
			value="<up:label property="botao.limpar" />" /></td>
	</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
		function validar(paramAcao)
		{
			
			document.frmCadSonho.action="<%=request.getContextPath()%>/SonhoServlet?acao="+paramAcao;
			document.frmCadSonho.submit();
			
			
		}
		</script> <!-- begin #footer -->
<div id="footer"><br />
<br />

&nbsp; &nbsp; <strong><pp:formatDate value="${agora}"
	dateStyle="full" /></strong> &nbsp; &nbsp; || &nbsp; &nbsp; <up:label
	property="rodape.texto" /></div>
<!-- end #footer --></div>
<!-- end #container -->
</body>
</html>
